home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue50 / IPC / Messages / MsgSendU.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1999-08-31  |  1.2 KB  |  56 lines

  1. unit MsgSendU;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  7.   StdCtrls, ComCtrls;
  8.  
  9. type
  10.   TMsgSendForm = class(TForm)
  11.     edtWParam: TEdit;
  12.     edtLParam: TEdit;
  13.     updWParam: TUpDown;
  14.     updLParam: TUpDown;
  15.     Label1: TLabel;
  16.     Label2: TLabel;
  17.     btnBroadcast: TButton;
  18.     btnBroadcast2: TButton;
  19.     procedure btnBroadcastClick(Sender: TObject);
  20.     procedure btnBroadcast2Click(Sender: TObject);
  21.   private
  22.     { Private declarations }
  23.   public
  24.     { Public declarations }
  25.   end;
  26.  
  27. var
  28.   MsgSendForm: TMsgSendForm;
  29.  
  30. implementation
  31.  
  32. uses
  33.   CustomMsgU;
  34.  
  35. {$R *.DFM}
  36.  
  37. procedure TMsgSendForm.btnBroadcastClick(Sender: TObject);
  38. begin
  39.   WinExec('MsgRcv1.Exe', sw_ShowNormal);
  40.   SendMessage(HWnd_BroadCast, wm_ClinicMessage,
  41.     updWParam.Position, updLParam.Position)
  42. end;
  43.  
  44. procedure TMsgSendForm.btnBroadcast2Click(Sender: TObject);
  45. var
  46.   Recipients: DWord;
  47. begin
  48.   WinExec('MsgRcv1.Exe', sw_ShowNormal);
  49.   Recipients := BSM_APPLICATIONS;
  50.   //Can make message be sent to all applications except this one
  51.   BroadcastSystemMsg(BSF_IGNORECURRENTTASK, @Recipients,
  52.     wm_ClinicMessage, updWParam.Position, updLParam.Position)
  53. end;
  54.  
  55. end.
  56.